require 'atom'
require 'net/http'
require 'uri'


class JournalController < ApplicationController

  layout 'main'
  
  def index
    list
    render :action => 'list', :params => {:id => 1}
  end

  def list

    request = 'http://www.blogger.com/feeds/3569243484046636710/posts/default?start-index=1&max-results=20'
    str = Net::HTTP.get(URI.parse(request))
    @feed = Atom::Feed.new(str)
    
    # @more = true unless @feed.entries.size < 6
    # entries.delete_at(6) if @more
  end
  
  def read
    
    request = 'http://www.blogger.com/feeds/3569243484046636710/posts/default?start-index='+@params['id'] + "&max-results=1"
    str = Net::HTTP.get(URI.parse(request))
    @feed = Atom::Feed.new(str)    
    
    
  end
  
  
end
